<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>计算器</title>
</head>
<body>
  <script>
    let n1 = +prompt('请输入数字1:')
    let n2 = +prompt('请输入数字2:')
    let o = prompt('请输入操作符号+-*/%')
    switch(o){
      case '+':{
        alert(`运算结果为${n1 + n2}`)
        break
      }
      case '-':{
        alert(`运算结果为${n1 - n2}`)
        break
      }
      case '*':{
        alert(`运算结果为${n1 * n2}`)
        break
      }
      case '/':{
        alert(`运算结果为${n1 / n2}`)
        break
      }
      case '%':{
        alert(`运算结果为${n1 % n2}`)
        break
      }
      default :{
        alert('操作符错误')
      }
    }
  </script>
</body>
</html>